package com.single.weblearn.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import com.single.weblearn.dao.ProductDao;
import com.single.weblearn.meta.Product;

@Controller
public class ShowController {
	@Autowired
	private ProductDao productDao;
	
	@RequestMapping(value = "/show", method = RequestMethod.GET)
	public String show(
			@RequestParam Integer id,ModelMap map) {
        Product product = productDao.getProduct(id);
        map.addAttribute("product", product);
		return "show";
	}
}
